package com.headingdata.demo;

public class MovieOperator {

    private Movie[] movies;

    public MovieOperator(Movie[] movies) {
        this.movies = movies;
    }

    public void printMovieList(){
        System.out.println("最近上映的电影如下：");

        for (int i = 0; i < movies.length; i++) {
            System.out.println("电影id：" + movies[i].getId());
            System.out.println("电影名称：" + movies[i].getName());
            System.out.println("电影价格：" + movies[i].getPrice());
            System.out.println("------------------------------------------------");
//            System.out.println(movies[i].getId() + "-" + movies[i].getName() + "-" + movies[i].getPrice());
//            System.out.println(movies[i].getActor() + "-" + movies[i].getDirector() + "-" + movies[i].getScore());
//            System.out.println(movies[i].getInfo());
        }
    }

    public void printMovieInfoById(int id){

        for (int i = 0; i < movies.length; i++) {
            if(id == movies[i].getId()){
                System.out.println("该电影详情：");
                System.out.println("电影编号：" + movies[i].getId());
                System.out.println("电影名称：" + movies[i].getName());
                System.out.println("电影价格：" + movies[i].getPrice());
                System.out.println("电影评分：" + movies[i].getScore());
                System.out.println("电影导演：" + movies[i].getDirector());
                System.out.println("电影演员：" + movies[i].getActor());
                System.out.println("电影信息：" + movies[i].getInfo());
                System.out.println("==========================================");
                return;
            }
        }
        System.out.println("没有该电影信息！");
    }
}
